/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2021-2023. All rights reserved.
 *
 */

import { Queue } from '../../../../common/util/queue.js';

/**
 * 一个包含TaskPath队列的对象
 *
 * @since 2023/11/09
 */
export class TaskQueue {
  private taskQueue: Queue<string>;

  constructor(capacity?: number) {
    this.taskQueue = new Queue(capacity);
  }

  public push(task: string): boolean {
    return this.taskQueue.push(task);
  }

  public pop(): string | undefined {
    return this.taskQueue.pop();
  }

  public peek(): string | undefined {
    return this.taskQueue.peek();
  }

  public size(): number {
    return this.taskQueue.size();
  }

  public toString(): string {
    return this.taskQueue.toString();
  }

  public isEmpty(): boolean {
    return this.taskQueue.size() === 0;
  }

  public clear(): void {
    this.taskQueue.clear();
  }

  public remove(task: string): string | undefined {
    return this.taskQueue.remove(task);
  }
}
